package com.jin.spirng_boot_learn;

import com.jin.spirng_boot_learn.BO.StudentBO;
import com.jin.spirng_boot_learn.properties.SystemConfigure;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Lookup;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.Transactional;

import java.util.stream.IntStream;


@Configuration
public class CommandLineTest implements CommandLineRunner,ApplicationContextAware{

    @Autowired
    private SystemConfigure systemConfigure;


    @Lookup
    @Transactional
    public StudentBO getStudentBo() {
        return null;
    }

    @Autowired
    private ApplicationContext applicationContext;


    @Override
    public void run(String... args) throws Exception {
        IntStream.range(1,10).forEach(i->System.out.println(getStudentBo()));
        System.out.println(applicationContext);

    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

    }
}
